<?php
namespace Pw\MainBundle\Entity;

use Doctrine\ORM\EntityRepository;

class HeroRepository extends EntityRepository
{
    public function getTalents($heroId)
    {
		$em = $this->getEntityManager();
		$query = $em->createQuery('SELECT t FROM PwMainBundle:Talent t WHERE t.heroId = :id')->setParameter('id', (int)$heroId);
		return $query->getResult();
		/*$stmt = $connection->prepare('select count(*) as count from subscribers_groups where group_id = ?');
		$stmt->bindValue(1, (int)$groupId, \PDO::PARAM_INT);
		$stmt->execute();*/
        /*$this->getEntityManager()
            ->createQuery('SELECT COUNT(*) FROM RMDAccountBundle:Group g WHERE g.lists_id=')
            ->getResult();*/
		//select count(*) as count from subscribers_groups where group_id = 16
		//return $connection->fetchColumn('select count(*) from subscribers_groups where group_id = ?', array((int)$groupId), 0);
    }
    public function findVisible()
    {
		$em = $this->getEntityManager();
		$query = $em->createQuery('SELECT h FROM PwMainBundle:Hero h WHERE h.visible = :visible')->setParameter('visible', true);
		return $query->getResult();
    }
}
